-
Notifications
You must be signed in to change notification settings - Fork 108
Migrate Collection Info to Dedicated Pages #725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Migrate Collection Info to Dedicated Pages #725
Conversation
- Created dedicated pages for each collection type: - trailbase-collection.md - local-storage-collection.md - local-only-collection.md - derived-collections.md - Simplified overview.md Collections section: - Reduced from ~743 to 408 lines (45% reduction) - Replaced detailed content with brief one-sentence descriptions - Added links to individual collection type pages - Each collection page includes: - Overview and use cases - Installation instructions - Configuration options - Code examples - Complete working examples - Cross-references to related documentation This makes the documentation more navigable and easier to maintain. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Reorganized the collection types in overview.md into logical categories: - Fetch Collections: QueryCollection - Sync Collections: ElectricCollection, TrailBaseCollection, RxDBCollection - Local Collections: LocalStorageCollection, LocalOnlyCollection - Derived Collections: Derived Collections This makes it easier to understand the different collection types at a glance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: 0 B Total Size: 84.5 kB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 2.89 kB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need a page for "derived collections"? these are what you get from a live query, and we have the live query docs?
| - **Data that should persist across sessions**: Use [`LocalStorageCollection`](./local-storage-collection.md) | ||
| - **Data that syncs across tabs**: Use [`LocalStorageCollection`](./local-storage-collection.md) | ||
| - **Server-synchronized data**: Use [`QueryCollection`](./query-collection.md) or [`ElectricCollection`](./electric-collection.md) | ||
| - **Offline-first with sync**: Use [`RxDBCollection`](./rxdb-collection.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an arbitrary suggestion...
| ) | ||
| ``` | ||
|
|
||
| ## Custom Storage Backend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is also a storageEventApi options that defaults to window, this allows the collection to subscribe to storage events. A custom storage implementation could also provide this to enable custom cross tab (or cross window/process etc) sync. We should document that.
| - **Large datasets**: localStorage has size limits (typically 5-10MB) | ||
| - **Server-synchronized data**: Use [`QueryCollection`](./query-collection.md) or [`ElectricCollection`](./electric-collection.md) | ||
| - **Session-only data without persistence**: Use [`LocalOnlyCollection`](./local-only-collection.md) | ||
| - **Offline-first with sync**: Use [`RxDBCollection`](./rxdb-collection.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arbitrary suggestion...
|
|
||
| A new collections doesn't start syncing until you call `collection.preload()` or you query it. | ||
|
|
||
| #### `RxDBCollection` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are removing the RxDBColleciton docs, and not replacing in them in a new file.
- Removed derived-collections.md page (covered in live queries docs) - Removed RxDBCollection from overview (being removed from library) - Removed arbitrary "When Not to Use" sections from local collection docs - Added storageEventApi documentation to LocalStorageCollection: - Documents custom event API for cross-tab/process sync - Added to optional options list - Included examples for Electron, WebSocket, and IPC use cases Changes based on feedback from @samwillis
…ction-docs-011CUXhbpUwQkUkz2fq7qQhx
Clarified that server collection mutations are handled by their operation handlers (onInsert, onUpdate, onDelete), not automatically without configuration. Updated comments to match the pattern shown in the mutations guide. Before: "Server collection mutations are handled automatically" After: "Server collection mutations are handled by their onInsert handler automatically (onInsert will be called and awaited first)"
Fixed a critical misunderstanding about how manual transactions work.
When using createTransaction, the collection's operation handlers
(onInsert, onUpdate, onDelete) are NOT automatically called. The
mutationFn is responsible for handling ALL persistence.
Changed examples from:
// Server collection mutations are handled automatically
To the correct pattern:
// Handle server collection mutations explicitly in mutationFn
await Promise.all(
transaction.mutations
.filter((m) => m.collection === serverCollection)
.map((m) => api.items.create(m.modified))
)
Fixed in:
- docs/guides/mutations.md
- docs/collections/local-only-collection.md
- docs/collections/local-storage-collection.md
Changed 'with a generic ingestion endpoint' to 'for real-time sync with your existing API' to accurately match what the example shows (api.todos.create()).
…ction-docs-011CUXhbpUwQkUkz2fq7qQhx
Created dedicated pages for each collection type:
Simplified overview.md Collections section:
Each collection page includes:
This makes the documentation more navigable and easier to maintain.
🤖 Generated with Claude Code
🎯 Changes
✅ Checklist
pnpm test:pr.🚀 Release Impact